package com.lancoo.ccas53.mapper;

import com.lancoo.ccas53.entity.Schedule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.ccas53.config.MybatisRedisCache;
import com.lancoo.ccas53.entity.ViewSchedule;
import com.lancoo.ccas53.pojo.dto.*;
import com.lancoo.ccas53.pojo.vo.MobileScheduleDto;
import com.lancoo.ccas53.service.impl.SyncScheduleDto;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;

/**
 * <p>
 * 课表 Mapper 接口
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface ScheduleMapper extends BaseMapper<Schedule> {

    int addBatch(@Param("scheduleCollection") Collection<Schedule> scheduleCollection);

    /**
     * 根据任务id获取全部课表
     * @param taskIds
     * @param campusId
     * @param isLocked
     * @param roomType
     * @return
     */
    List<ArrangeScheduleDto> getScheduleLockedByIds(@Param("taskIds") List<Integer> taskIds, @Param("campusId") String campusId, @Param("isLocked") Integer isLocked);
    /**
     * 获取锁定的教学班课表
     * @param taskId
     * @param campusId
     * @return
     */
    List<ArrangeScheduleDto> getScheduleLocked(@Param("taskId") Integer taskId, @Param("campusId") String campusId, @Param("isLocked") Integer isLocked, @Param("collegeId") String collegeId);

    List<ArrangeScheduleDto> addRuleSchedule(List<ArrangeTeachingClassDto> teachingClassDtoList);

    List<ScheduleDto> getAllScheduleByTeachingClassIds(Integer taskId, List<Long> teachingClassIds);

    /**
     * 根据教学班id获取多个教学班教学安排
     *
     * @param taskId
     * @param teachingClassIds
     * @return
     */
    List<MobileScheduleDto> getScheduleByTeachingClassIds(@Param("taskId") Integer taskId, @Param("teachingClassIds") List<Long> teachingClassIds);




    List<ViewSchedule> getTeacherScheduledTimeCodes(List<Integer> taskIds, String teacherId);

    List<ScheduleDto> getAllScheduleByTeachingClassIdAndHourType(Long teachingClassId, Integer hourType);

    List<ViewSchedule> getAllSchedule(List<Integer> taskIds);

    List<ViewSchedule> getAllScheduleWithStudent(List<Integer> taskIds);

    List<ViewScheduleDto> getUnRangeScheduleByTeachingClassIds(Integer taskId, List<Long> teachingClassIds);
    List<ViewScheduleDto> getUnRangeScheduleByTimeGroup(List<String> groups);

    void removeSchedule(Long roomId, List<Schedule> scheduleList);

    List<SyncScheduleDto> syncScheduleDto(Integer taskId, Integer type);

    List<ViewSchedule> getScheduledSelectTimeCodes(Integer taskId, List<Long> tcIds);

    List<ScheduleRedisDto> scheduleToRedis(Integer taskId);
}
